<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>后台管理</title>
<link href="__PUBLIC__/ht/css/main.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="__PUBLIC__/ht/js/jquery.js"></script>
<script type="text/javascript" src="__PUBLIC__/ht/js/action.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugins/xheditor/xheditor-1.2.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/plugins/xheditor/xheditor_lang/zh-cn.js"></script>
</head>
<body>

<div class="aaa_pts_show_1">【 新闻管理 】</div>

<div class="aaa_pts_show_2">
    
    <div>
       <div class="aaa_pts_4"><a href="{:U('index')}">全部新闻</a></div>
       <div class="aaa_pts_4"><?php if($_GET['news_id']) { ?><a href="#">修改新闻</a><?php }else{ ?><a href="{:U('add')}">添加新闻</a><?php } ?></div>
    </div>
    <div class="aaa_pts_3">
      <form action="{:u('save')}" method="post" enctype="multipart/form-data" onsubmit="return ac_from();">
      <ul class="aaa_pts_5">
         <li>
            <div class="d1">新闻标题:</div>
            <div>
              <input class="inp_1" name="name" id="name" style="width:450px;" value="<?php echo $news['name']; ?>"/>
            </div>
         </li>
         <li>
            <div class="d1">所属类别:</div>
            <div>
              <select class="inp_1" name="pid" id="pid">
			         <option value="">选择类别</option>
                <volist name='cate_list' id='cate'>
                  <if condition="$cate.id eq $news['cid']">
                  <option value="{$cate.id}" selected="selected" >- {$cate.name}</option>
                  <else />
                  <option value="{$cate.id}" >- {$cate.name}</option>
                  </if>
                </volist>
              </select>
            </div>
         </li>
         <li>
            <div class="d1">来源:</div>
            <div>
              <input class="inp_1" name="from" id="from" style="width:450px;" value="<?php echo $news['from']; ?>"/>
            </div>
         </li>
         <li>
            <div style="color:#c00; font-size:14px; padding-left:20px;">上传图片大小：100px*100px,格式为jpg、jpeg、png</div>
         </li>
         <li data-index="'.$key.'">
            <div class="d1">新闻图片:</div>
            <div>
              <if condition="$news['photo'] neq ''">
              <img style="width:100px;height:100px;" src="__DATA__/<?php echo $news['photo']; ?>" />
              </if>
              <input type="hidden" name="photo" id="photo" value="<?php echo $news['photo']; ?>"/>
			        <input type="file" name="file" id="photo" />
            </div>
         </li>
		 
         <li>
            <div class="d1">新闻内容:</div>
            <div>
              <textarea class="inp_1 inp_2" name="content" id="content"/><?php echo $news['content']; ?></textarea>
            </div>
         </li>
         <li>
            <div class="d1">排序:</div>
            <div>
              <input class="inp_1" name="sort" id="sort" value="<?php echo (int)$news['sort']?>"/> &nbsp;&nbsp;排序数量越大，排名越靠前
            </div>
         </li>
         <li>
            <div class="d1">发表时间:</div>
            <div>
              <input class="inp_1" name="addtime" id="addtime" value="<?php echo $news['addtime']!='' ? date("Y-m-d H:i:s",$news['addtime']) : date("Y-m-d H:i:s"); ?>"/>
            </div>
         </li>
         
         <li>
            <div class="d1">浏览次数:</div>
            <div>
              <input class="inp_1" name="renqi" id="renqi" value="<?php echo (int)$news['renqi']?>"/> 
            </div>
         </li>
         <input type="hidden" name="news_id" value="<?php echo (int)$news['id']; ?>"/>
         <li><input type="submit" name="submit" value="提交" class="aaa_pts_web_3" border="0"></li>
      </ul>
      </form>
         
    </div>
    
</div>
<script>
function ac_from(){

  var name=document.getElementById('name').value;
  
  if(name.length<2){
	  alert('新闻名称不能少于2');
	  return false;
	  } 
  
  var pid=parseInt(document.getElementById('pid').value);
  if(isNaN(pid) || pid<1){
	  alert('请选择分类');
	  return false;
	  } 
	  
}

//初始化编辑器
$('#content').xheditor({
	skin:'nostyle' ,
	upImgUrl:'{:U("Upload/xheditor")}'
});
</script>
</body>
</html>